﻿using SRB.Tg.DrawingStandard;
using SRB.Tg.Operate;
using System;
using System.Collections.Generic;
using System.Data;
using Teigha.DatabaseServices;
using Teigha.Geometry;

namespace SRB.Tg.Model
{
    public class PierStructure_bak
    {
        #region  "墩柱构造图"
      
        /// <summary>
        /// 立面
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public static void PlotPierelEvation(ref Database db, ref Extents2d ext, Point2d insertPoint, PierPara pierPara, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "立面", "1:150", scale);
            Point2d pt = insertPoint.C2D(0, -22 * scale);

            Point3d ptDim = pt.C3D(-pierPara.beam_w * 0.5 - 20 * scale);
            //Point3d ptDimR = pt.C3D(pierPara.beam_w * 0.5 + 20 * scale);
            double halfPile = 15 * scale;//桩长示意长度
            #region 盖梁外轮廓绘制
            double ang = Math.Atan(pierPara.beam.slopew / 100);
            double BeamH = (pierPara.h4 - pierPara.h3) * 100;
            List<Point2d> ptLst = new List<Point2d>();
            //ptLst.Add(pt);
            double BeamW = pierPara.beam_w;
            Point2d pt1 = pt.C2D(-(pierPara.beam_w * 0.5 - pierPara.beam.block_w), -(pierPara.beam_w * 0.5 - pierPara.beam.block_w) * pierPara.beam.slopew * 0.01);
            Point2d pt2 = pt1.C2D(0, pierPara.beam.block_h);
            Point2d pt3 = pt2.C2D(-pierPara.beam.block_w, 0);
            Point2d pt40 = pt3.C2D(0, -pierPara.beam.block_h);
            //Point2d pt4 = pt.C2D(-(pierPara.beam_w * 0.5), -pierPara.beam.block_h);
            Point2d pt4 = pt3.C2D(pierPara.beam.block_h * pierPara.beam.slopew * 0.01, -pierPara.beam.block_h);
            //Point2d pt5 = pt.C2D(-pierPara.beam_w * 0.5, -pierPara.beam.beam_h);
            //Point2d pt5 = pt4.C2D(0, -pierPara.beam.beam_h );
            Point2d pt5 = pt4.C2D(pierPara.beam.beam_h * Math.Sin(ang), -pierPara.beam.beam_h * Math.Cos(ang));

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            ptLst.Add(pt5);
            Point2d ptBMid = pt.C2D(0, -(pierPara.h4 - pierPara.h3) * 100);
            //Point2d pt6 = ptBMid.C2D(-pierPara.column.top_w * 0.5 - pierPara.beam.kw, -(pierPara.column.top_w * 0.5 + pierPara.beam.kw) * pierPara.beam.slopew * 0.01);
            //Point2d pt7 = ptBMid.C2D(-pierPara.column.top_w * 0.5, -(pierPara.column.top_w * 0.5) * pierPara.beam.slopew * 0.01);//墩起点
            //Point2d pt8 = ptBMid.C2D(pierPara.column.top_w * 0.5, (pierPara.column.top_w * 0.5) * pierPara.beam.slopew * 0.01);//墩起点
            //Point2d pt9 = ptBMid.C2D(pierPara.column.top_w * 0.5 + pierPara.beam.kw, (pierPara.column.top_w * 0.5 + pierPara.beam.kw) * pierPara.beam.slopew * 0.01);
            Point2d pt60 = ptBMid.C2D(-(pierPara.beam_w * 0.5), -(pierPara.beam.beam_w * Math.Sin(ang)));
            Point2d pt61 = pt4.C2D(BeamH * Math.Sin(ang), -(BeamH * Math.Cos(ang)));
            Point2d pt6 = ptBMid.C2D(-(pierPara.beam_w * 0.5 - pierPara.beam.beam_w * Math.Cos(ang)), -(pierPara.beam_w * 0.5 - pierPara.beam.beam_w * Math.Cos(ang)) * pierPara.beam.slopew * 0.01);
            Point2d pt7 = ptBMid.C2D(-pierPara.column.top_w * 0.5, -(pierPara.column.top_w * 0.5) * pierPara.beam.slopew * 0.01);//墩起点
            Point2d pt8 = ptBMid.C2D(pierPara.column.top_w * 0.5, (pierPara.column.top_w * 0.5) * pierPara.beam.slopew * 0.01);//墩起点
            Point2d pt9 = ptBMid.C2D((pierPara.beam_w * 0.5 - pierPara.beam.beam_w * Math.Cos(ang)), (pierPara.beam_w * 0.5 - pierPara.beam.beam_w * Math.Cos(ang)) * pierPara.beam.slopew * 0.01);
            Point2d pt90 = ptBMid.C2D((pierPara.beam_w * 0.5), (pierPara.beam.beam_w * Math.Sin(ang)));
            ptLst.Add(pt6);
            ptLst.Add(pt7);
            ptLst.Add(pt8);
            ptLst.Add(pt9);

            Point2d pt10 = pt.C2D((pierPara.beam_w * 0.5 - pierPara.beam.block_w), (pierPara.beam_w * 0.5 - pierPara.beam.block_w) * pierPara.beam.slopew * 0.01);
            Point2d pt11 = pt10.C2D(0, pierPara.beam.block_h);
            Point2d pt12 = pt11.C2D(pierPara.beam.block_w, 0);
            Point2d pt13 = pt12.C2D(0, -pierPara.beam.block_h);
            //Point2d pt13 = pt12.C2D(-pierPara.beam.block_h * pierPara.beam.slopew * 0.01, -pierPara.beam.block_h);
            //Point2d pt14 = pt.C2D(pierPara.beam_w * 0.5, -pierPara.beam.beam_h);
            //Point2d pt14 = pt13.C2D(0, -pierPara.beam.beam_h);
            Point2d pt14 = pt13.C2D(-pierPara.beam.beam_h * Math.Sin(ang), -pierPara.beam.beam_h * Math.Cos(ang));
            //Point2d pt14 = pt13.C2D(-pierPara.beam.beam_h * pierPara.beam.slopew * 0.01 , -pierPara.beam.beam_h);

            ptLst.Add(pt14);
            ptLst.Add(pt13);
            ptLst.Add(pt12);
            ptLst.Add(pt11);
            ptLst.Add(pt10);
            PLPloter.AddPolylineByPointList(db,ptLst, ref ext, "H墩身", true);
            DimPloter.DimRot(db, pt3.C3D(), pt12.C3D(), pt.C3D(0, 18 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            //DimPloter.DimAli(db,pt3.C3D(), pt12.C3D(), pt.C3D(0, 15 * scale), ref ext,scale, "B="+ pierPara.beam_w+ "/cosα", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt2.C3D(), pt11.C3D(), pt.C3D(0, 13 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            if (ang == 0)
            {
                DimPloter.DimRot(db, pt4.C3D(), pt5.C3D(), ptDim.C3D(5 * scale), ref ext, 90 - ang, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt13.C3D(), pt14.C3D(), pt12.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt61.C3D(), pt5.C3D(), ptDim.C3D(5 * scale), ref ext, 90 - ang, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, pt4.C3D(), pt5.C3D(), pt3.C3D(-5 * scale), ref ext, 90 - ang, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt13.C3D(), pt14.C3D(), pt12.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt61.C3D(), pt5.C3D(), pt3.C3D(-5 * scale), ref ext, 90 - ang, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            //DimPloter.DimAli(db,pt61.C3D(), pt5.C3D(), pt61.C3D(-5 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter,false);
            DimPloter.DimAli(db,pt60.C3D(), pt6.C3D(), pt7.C3D(0, -5 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter);
            if (pierPara.beam.slopew!=0)
            {
                DimPloter.DimRot(db, pt6.C3D(), pt7.C3D(), pt7.C3D(0, -5 * scale), ref ext, 0, scale, "k", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt8.C3D(), pt9.C3D(), pt7.C3D(0, -5 * scale), ref ext, 0, scale, "k", Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, pt6.C3D(), pt7.C3D(), pt7.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt8.C3D(), pt9.C3D(), pt7.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            DimPloter.DimRot(db, pt8.C3D(), pt7.C3D(), pt7.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt14.C3D(), pt9.C3D(), pt7.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimAli(db,pt90.C3D(), pt9.C3D(), pt7.C3D(0, -5 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter);
            if (pierPara.beam.block_w > 0)
            {
                DimPloter.DimRot(db, pt2.C3D(), pt3.C3D(), pt.C3D(0, 13 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt11.C3D(), pt12.C3D(), pt.C3D(0, 13 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                if (ang == 0)
                {
                    DimPloter.DimRot(db, pt3.C3D(), pt40.C3D(), ptDim.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
                else
                    DimPloter.DimRot(db, pt3.C3D(), pt40.C3D(), pt3.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt12.C3D(), pt13.C3D(), pt12.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimAli(db,pt3.C3D(), pt4.C3D(), pt3.C3D(-5 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            Line line1 = new Line(pt7.C3D(), pt8.C3D());
            Line line2 = new Line(ptBMid.C3D(), ptBMid.C3D(pierPara.column.top_w * 0.5 * 0.5));
            Point3d ptA = GeTools.MidPoint(pt8.C3D(), ptBMid.C3D(pierPara.column.top_w * 0.5 * 0.5));
            //DimPloter.DimAng(db, line2, line1, ptA.C3D(), ref ext,  scale, "α=<>", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimAng(db,line2, line1, ptA.C3D(), ref ext, scale, "α", Unit.Centimeter, Unit.Centimeter);
            //TextPloter.AddDBText(db,pt.C3D(-5*scale, 0.5 * scale),ref ext,  "i%", scale);
            if (pierPara.beam.slopew > 0)
                //DimPloter.AddL2RBP("i %", pt.C3D(-pierPara.beam_w * 0.2, 0.5 * scale), ref ext, scale, 3,false);
                TextPloter.AddTexWithArrow(db,pt.C3D(-pierPara.beam_w * 0.2, 0.5 * scale), ref ext, "i %", scale, 2, eDirection.E_LEFT);
            else if (pierPara.beam.slopew < 0)
                TextPloter.AddTexWithArrow(db,pt.C3D(pierPara.beam_w * 0.3, 0.5 * scale), ref ext, "i %", scale, 2, eDirection.E_RIGHT);
            //else
            //    TextPloter.AddTexWithArrow(db,pt.C3D(-pierPara.beam_w * 0.2, 0.5 * scale), ref ext, "0 %", scale, 2, eDirection.E_LEFT);
            //DimPloter.AddL2RBP("i %", pt.C3D(pierPara.beam_w * 0.3, 0.5 * scale), ref ext, scale, 3,true);


            //DimPloter.AddBG(db,pierPara.h4, pt.C3D(), ref ext, scale);
            //DimPloter.AddBG(db,pierPara.h3, ptBMid.C3D(), ref ext, scale);

            DimPloter.DimBG(db,"H4", pt.C3D(), ref ext, scale);
            DimPloter.DimBG(db,"H3", ptBMid.C3D(), ref ext, scale);
            #endregion

            #region 墩身轮廓绘制
            double cap = 2 * scale;
            int BulkheadCount = 2;
            if (pierPara.pier_height <= 30)
                BulkheadCount = 0;
            else if (pierPara.pier_height > 30 && pierPara.pier_height <= 60)
                BulkheadCount = 1;
            else if (pierPara.pier_height >= 60 )
                BulkheadCount = 2;
            //else if (pierPara.pier_height >= 60 && pierPara.pier_height < 90)
            //    BulkheadCount = 2;
            //else if (pierPara.pier_height >= 90 && pierPara.pier_height < 120)
            //    BulkheadCount = 3;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            double bwL = double.Parse(sizeBulkL[0]);
            int thickness = pierPara.column.top_thickness;
            double topThickness = double.Parse(thickness.ToString());
            double bottomThickness = double.Parse(thickness.ToString());
            double FH = topH + tH + 15 * scale;
            double MH = 30 * scale + mH * 2 + bH;
            double BH = botH + tH + 15 * scale;
            if (BulkheadCount == 0)
            {
                FH = topH + tH + 35 * scale;
                MH = 0;
                BH = botH + tH + 35 * scale;
                if(FH+BH>pierPara.pier_height*100)
                {
                    FH = pierPara.pier_height * 100*0.5;
                    MH = 0;
                    BH = pierPara.pier_height * 100 * 0.5;
                }
            }
            else  if (BulkheadCount == 1)
                MH = 40 * scale + mH * 2 + bH;
            else if (BulkheadCount == 2)
                MH = 30 * scale + mH * 2 + bH;
            else
                MH = 20 * scale + mH * 2 + bH;
            #region 外轮廓上部
            //double FH = topH  + tH+25*scale;
            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_w * 0.5 + FH * pierPara.column.slope_w), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_w * 0.5 + FH * pierPara.column.slope_w), -FH);
            PLPloter.AddLine(db,pt7, ptCF1, ref ext, "H墩身");
            PLPloter.AddLine(db,pt8, ptCF2, ref ext, "H墩身");
            //if (pierPara.column.slope_w > 0)
            PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            //else
            //    PLPloter.CreateBreakLineP(db, ref ext, ptCF1, ptCF2, scale, "H细线");

            DimPloter.AddLeft2RightBJ(db,"B", ptCF1.C3D(-6 * scale, -FH * 0.3), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"B", ptCF2.C3D(6 * scale, -FH * 0.3), ref ext, scale, 3, false);
            DimPloter.DimRot(db, ptBMid.C3D(0, -FH + 10 * scale), ptBMid.C3D(pierPara.beam_w * 0.5 + 21.75 * scale, -FH + 10 * scale), ptBMid.C3D(0, -FH + 10 * scale), ref ext, 0, scale, "S=" + pierPara.beam_w * 0.5 + "+217.5", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D(0, -topH);
            Point2d ptICF1 = ptBMid.C2D(-(pierPara.column.top_w * 0.5 + (topH + tH) * pierPara.column.slope_w) + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D((pierPara.column.top_w * 0.5 + (topH + tH) * pierPara.column.slope_w) - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            //PLPloter.AddScaleLine(pt7.C2D(topThickness), ptICF1, ref ext, "H虚线", 2);
            //PLPloter.AddScaleLine(pt8.C2D(-topThickness), ptICF2, ref ext, "H虚线", 2);

            DimPloter.DimRot(db, pt7.C3D(), pt7.C3D(topThickness), pt8.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt8.C3D(), pt8.C3D(-topThickness), pt8.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt7.C3D(topThickness), pt8.C3D(-topThickness), pt8.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            DimPloter.DimRot(db, ptICF1.C3D(), ptICF1.C3D(-topThickness), ptICF1.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICF1.C3D(), ptICF1.C3D(tw), ptICF1.C3D(0, tH + 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICF1.C3D(), ptICF1.C3D(0, tH), ptICF1.C3D(-3 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            Point3d ptMT = GeTools.MidPoint(ptICF1.C3D(), ptICF1.C3D(tw, tH));
            DimPloter.AddMLeader(db,ptMT.C2D(), ptMT.C2D(2 * scale, -4 * scale), pierPara.column.section_w_ang, ref ext, scale);
            if (pierPara.beam.slopew > 0)
            {
                DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(0, -tH), ptDim.C3D(5 * scale), ref ext, 90, scale, (topH + tH) + "-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(), ptDim.C3D(10 * scale), ref ext, 90, scale, topH + "-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(), ptIC.C3D(0, -tH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter,false);

                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(0, -tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, (topH + tH) + "+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(), ptDimR.C3D(-10 * scale), ref ext, 90, scale, topH + "+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(), ptIC.C3D(0, -tH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            else if (pierPara.beam.slopew < 0)
            {
                DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(0, -tH), ptDim.C3D(5 * scale), ref ext, 90, scale, (topH + tH) + "+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(), ptDim.C3D(10 * scale), ref ext, 90, scale, topH + "+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(), ptIC.C3D(0, -tH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, false);

                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(0, -tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, (topH + tH) + "-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(), ptDimR.C3D(-10 * scale), ref ext, 90, scale, topH + "-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(), ptIC.C3D(0, -tH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(0, -tH), ptDim.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(), ptIC.C3D(0, -tH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(0, -tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, pt7.C3D(), ptIC.C3D(), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(), ptIC.C3D(0, -tH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            #endregion

            #region 外轮廓中部
            //double MH = 40*scale  + mH*2+ bH;
            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -cap - MH);
            if (pierPara.column.slope_w > 0)
            {
                TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_w, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            }
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                //if(pierPara.column.slope_w>0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                //else
                //     PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(), ptCM2.C2D(), scale, "H墩身");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H墩身");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H墩身");
                //if (pierPara.column.slope_w > 0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");
                //else
                //    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E, ptCM2E, scale, "H墩身");
            }
            #endregion

            #region 内轮廓中部
            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            //Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
                Point3d ptMM = GeTools.MidPoint(ptICM3.C3D(), ptICM5.C3D());
                DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(2 * scale, 5 * scale), pierPara.column.section_mid_w_ang, ref ext, scale);
                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

                DimPloter.AddMLeader(db,ptICM.C2D(-bw * 0.5 + 1 * scale, -bH), ptICM.C2D(-bw * 0.5 + 2 * scale, -bH - 6 * scale), "人洞" + bw + "×" + bwL + "×" + bH, ref ext, scale);
                //DimPloter.DimRot(db, ptICM.C3D(-bw * 0.5), ptICM.C3D(bw * 0.5), ptICM.C3D(0, 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptICM.C3D(), ptICM.C3D(0, -bH), ptICM.C3D(bw * 0.5 + 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

                //DimPloter.DimRot(db, ptICM3.C3D(), ptICM3.C3D(mw), ptICM3.C3D(0, mH + 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptICM3.C3D(), ptICM3.C3D(0, mH), ptICM3.C3D(-3 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

                if (i == BulkheadCount - 1 && bottomThickness != topThickness)
                {
                    Point2d ptTN = ptICM3.C2D(-15 * scale);
                    TextPloter.AddTexWithArrow(db,ptTN.C3D(0, 2 * scale), ref ext, "向上 " + topThickness + "cm 等厚", scale, 2, eDirection.E_TOP, 2);
                    TextPloter.AddTexWithArrow(db,ptTN.C3D(0, -2 * scale), ref ext, "向下" + topThickness + "~" + bottomThickness + "cm 渐变", scale, 2, eDirection.E_BOTTOM, 2);
                    DimPloter.DimRot(db, ptICM3.C3D(), ptICM3.C3D(-topThickness), ptICM3.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
            }



            #endregion

            #region 外轮廓下部
            //double BH = botH  + tH +25*scale;
            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_w + pierPara.pier_height * 100 * pierPara.column.slope_w;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_w, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale, -cap), ptCM2E.C2D(5 * scale, -cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H墩身");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H墩身");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H墩身");
            if (pierPara.column.slope_w == 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            else
                DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "Bd1", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_w + bottomThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w - bottomThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_w + bottomThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_w - bottomThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(bottomThickness, -tH);
            Point2d ptICB6 = ptICB4.C2D(-bottomThickness, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
            #endregion          
            DimPloter.DimRot(db, ptCB1E.C3D(), ptCB1E.C3D(bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICB3.C3D(), ptICB3.C3D(tw), ptICB3.C3D(0, 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptCB2E.C3D(), ptCB2E.C3D(-bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            if (pierPara.column.slope_w == 0)
                DimPloter.DimRot(db, ptCB1E.C3D(bottomThickness), ptCB2E.C3D(-bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            else
                DimPloter.DimRot(db, ptCB1E.C3D(bottomThickness), ptCB2E.C3D(-bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "Bd1-" + bottomThickness * 2, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICB4.C3D(), ptICB4.C3D(-tw), ptICB4.C3D(0, 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            Point3d ptMB = GeTools.MidPoint(ptICB3.C3D(), ptICB5.C3D());
            DimPloter.AddMLeader(db,ptMB.C2D(), ptMB.C2D(2 * scale, 5 * scale), pierPara.column.section_w_ang, ref ext, scale);
            if (pierPara.beam.slopew > 0)
            {
                //左侧标注
                DimPloter.DimRot(db, pt7.C3D(), ptBottomC.C3D(), ptDim, ref ext, 90, scale, "H-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptIC.C3D(0, -tH), ptBottomC.C3D(0, botH + tH), ptDim.C3D(5 * scale), ref ext, 90, scale, "H-" + (topH + botH + tH * 2) + "-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH + tH), ptDim.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(0, botH), ptBottomC.C3D(0, botH + tH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //右侧标注
                //DimPloter.DimRot(db, pt8.C3D(), ptBottomC.C3D(), ptDimR, ref ext, 90, scale, "H+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(0, -tH), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "H-" + (topH + botH + tH * 2) + "+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(0, botH), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            else if (pierPara.beam.slopew < 0)
            {
                //左侧标注
                DimPloter.DimRot(db, pt7.C3D(), ptBottomC.C3D(), ptDim, ref ext, 90, scale, "H+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptIC.C3D(0, -tH), ptBottomC.C3D(0, botH + tH), ptDim.C3D(5 * scale), ref ext, 90, scale, "H-" + (topH + botH + tH * 2) + "+" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH + tH), ptDim.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(0, botH), ptBottomC.C3D(0, botH + tH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //右侧标注
                //DimPloter.DimRot(db, pt8.C3D(), ptBottomC.C3D(), ptDimR, ref ext, 90, scale, "H-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(0, -tH), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "H-" + (topH + botH + tH * 2) + "-" + pierPara.column.top_w * 0.5 + " i%", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(0, botH), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                //左侧标注
                DimPloter.DimRot(db, pt7.C3D(), ptBottomC.C3D(), ptDim, ref ext, 90, scale, "H", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptIC.C3D(0, -tH), ptBottomC.C3D(0, botH + tH), ptDim.C3D(5 * scale), ref ext, 90, scale, "H-" + (topH + botH + tH * 2), Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH + tH), ptDim.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(0, botH), ptBottomC.C3D(0, botH + tH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //右侧标注
                //DimPloter.DimRot(db, pt8.C3D(), ptBottomC.C3D(), ptDimR, ref ext, 90, scale, "H" , Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptIC.C3D(0, -tH), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "H-" + (topH + botH + tH * 2), Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptBottomC.C3D(0, botH), ptBottomC.C3D(0, botH + tH), ptDimR.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            if (bottomThickness != topThickness)
            {
                DimPloter.AddLeft2RightBJ(db,"D", ptICB1.C3D(-6 * scale - (BIH * pierPara.column.slope_w + bottomThickness), -8 * scale), ref ext, scale, 3, true);
                DimPloter.AddLeft2RightBJ(db,"D", ptICB2.C3D(6 * scale + (BIH * pierPara.column.slope_w + bottomThickness), -8 * scale), ref ext, scale, 3, false);
            }

            //PLPloter.AddScaleLine(ptCB1E.C2D(bottomThickness), ptICB3, ref ext, "H虚线", 2);
            //PLPloter.AddScaleLine(ptCB2E.C2D(-bottomThickness), ptICB4, ref ext, "H虚线", 2);
            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.pileCap.pile_cap_width;
            double pileCapH = pierPara.pileCap.pile_cap_height;
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H墩身", true);
            //垫层
            PLPloter.AddPloy4(db, ptBottomC.C2D(0,-pierPara.pileCap.pile_cap_height), pileCapW * 0.5+10, pileCapW * 0.5+10,20, ref ext, "H墩身");
            DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(-pileCapW * 0.5, -pileCapH), ptDim, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(-pileCapW * 0.5, -pileCapH), ptDimR, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0, -10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            //DimPloter.AddBG(db,pierPara.h2, ptBottomC.C3D(pileCapW * 0.5 + 5 * scale), ref ext, scale);
            DimPloter.DimBG(db,"H2", ptBottomC.C3D(pileCapW * 0.5 + 5 * scale), ref ext, scale);
       
            DimPloter.AddLeft2RightBJ(db,"A", ptBottomC.C3D(-6 * scale - pileCapW * 0.5, -4 * scale), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"A", ptBottomC.C3D(6 * scale + pileCapW * 0.5, -4 * scale), ref ext, scale, 3, false);
            #endregion

            #region 桩基外轮廓绘制

            Point2d ptPileT = ptBottomC.C2D(0, -pileCapH);
            double pileDia = pierPara.pile.dia;
            string[] span = pierPara.pile.span_w.Split('+');
            List<double> spanLst = new List<double>();
            double total = 0;
            for (int i = 0; i < span.Length; i++)
            {
                if (span[i].Contains("*"))
                {
                    string[] sp = span[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spanLst.Add(v);
                        total += v;
                    }
                }
                else
                {
                    if (double.Parse(span[i]) > 0)
                    {
                        spanLst.Add(double.Parse(span[i]));
                        total += double.Parse(span[i]);
                    }
                    else
                    {
                        spanLst.Add(0);
                    }
                }
            }
            Point2d ptSt = ptPileT.C2D(-total * 0.5);

            if (spanLst.Count > 0)
            {
                Point2d ptP1 = ptSt.C2D(-pileDia * 0.5);
                Point2d ptP2 = ptSt.C2D(pileDia * 0.5);
                //桩基
                PLPloter.AddLine(db,ptP1, ptP1.C2D(0, -halfPile), ref ext, "H墩身");
                PLPloter.AddLine(db,ptP2, ptP2.C2D(0, -halfPile), ref ext, "H墩身");

                //DimPloter.DimRot(db, ptP1.C3D(), ptP2.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptPileT.C3D(-pileCapW * 0.5), ptPileT.C3D(pileCapW * 0.5), ptPileT.C3D(0, -13 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptPileT.C3D(-pileCapW * 0.5), ptP1.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptPileT.C3D(-pileCapW * 0.5), ptPileT.C3D(pileCapW * 0.5), ptPileT.C3D(0, -13 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptPileT.C3D(-pileCapW * 0.5), ptSt.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

                PLPloter.AddUpperArcBreakLine(db, ptSt.C2D(0, -halfPile), ref ext, pileDia, "H细线");
                PLPloter.AddBottomArcBreakLine(db, ptSt.C2D(0, -5 * scale - halfPile), ref ext, pileDia, "H细线");

                PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                PLPloter.AddLine(db,ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                PLPloter.AddScaleLine(db, ptSt.C2D(), ptSt.C2D(0, -halfPile * 2 - 5 * scale - 2 * scale), ref ext, "H中心线", 5);
                for (int i = 0; i < spanLst.Count; i++)
                {
                    if (spanLst[i] > 0)
                    {
                        ptSt = ptSt.C2D(spanLst[i]);
                        ptP1 = ptSt.C2D(-pileDia * 0.5);
                        ptP2 = ptSt.C2D(pileDia * 0.5);

                        //DimPloter.DimRot(db, ptP1.C3D(), ptP2.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptSt.C3D(-spanLst[i]+ pileDia * 0.5), ptP1.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        DimPloter.DimRot(db, ptSt.C3D(-spanLst[i]), ptSt.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        if (i == spanLst.Count - 1)
                        {
                            //DimPloter.DimRot(db, ptPileT.C3D(pileCapW * 0.5), ptP2.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                            DimPloter.DimRot(db, ptSt.C3D(), ptPileT.C3D(pileCapW * 0.5), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        }
                        //DimPloter.DimRot(db, ptSt.C3D(-spanLst[i]), ptSt.C3D(), ptPileT.C3D(0, -halfPile * 2), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //桩基
                        PLPloter.AddLine(db,ptP1, ptP1.C2D(0, -halfPile), ref ext, "H墩身");
                        PLPloter.AddLine(db,ptP2, ptP2.C2D(0, -halfPile), ref ext, "H墩身");

                        PLPloter.AddUpperArcBreakLine(db, ptSt.C2D(0, -halfPile), ref ext, pileDia, "H细线");
                        PLPloter.AddBottomArcBreakLine(db, ptSt.C2D(0, -5 * scale - halfPile), ref ext, pileDia, "H细线");

                        PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                        PLPloter.AddLine(db,ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                        PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");

                        PLPloter.AddScaleLine(db, ptSt.C2D(), ptSt.C2D(0, -halfPile * 2 - 5 * scale - 2 * scale), ref ext, "H中心线", 5);
                    }
                }
            }
            DimPloter.DimRot(db, ptPileT.C3D(), ptPileT.C3D(0, -halfPile * 2 - 5 * scale), ptDim, ref ext, 90, scale, "L", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptPileT.C3D(), ptPileT.C3D(0, -halfPile * 2 - 5 * scale), ptDimR, ref ext, 90, scale, "L", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.AddBG(db,pierPara.h1, ptPileT.C3D(pileCapW * 0.5 + 5 * scale, -halfPile * 2 - 5 * scale), ref ext, scale);
            DimPloter.DimBG(db,"H1", ptPileT.C3D(pileCapW * 0.5 + 5 * scale, -halfPile * 2 - 5 * scale), ref ext, scale);
            #endregion

            #region 中心线
            DimPloter.AddMark(db,"C", pt.C3D(0, 7 * scale), ref ext, scale);
            DimPloter.AddMark(db,"C", ptPileT.C3D(0, -halfPile * 2 - 5 * scale - 7 * scale), ref ext, scale);
            PLPloter.AddScaleLine(db, pt.C2D(0, 5 * scale), ptPileT.C2D(), ref ext, "H中心线", 5);

            PLPloter.AddScaleLine(db, pt.C2D(pierPara.beam_w * 0.5 + 21.75 * scale, 15 * scale), ptPileT.C2D(pierPara.beam_w * 0.5 + 21.75 * scale, -halfPile * 2 - 5 * scale), ref ext, "H中心线", 5);
            //TextPloter.AddDBText(db,pt.C3D(pierPara.beam_w * 0.5 + 25 * scale, -halfPile * 2 - 5 * scale), ref ext, "道 路 中 线", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            //TextPloter.AddDBText(db,pt.C3D(0, -BeamH -halfPile * 2 - 5 * scale), ref ext, "桥 墩 中 线", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            TextPloter.AddMText(db,pt.C3D(pierPara.beam_w * 0.5 + 21.75 * scale+1*scale , -halfPile * 2 - 5 * scale), ref ext, "道 路 中 心 线", scale, 2.5, 3 * scale, "SRB.HT");
            TextPloter.AddMText(db,pt.C3D(1 * scale, -BeamH - halfPile * 2 - 5 * scale), ref ext, "桥 墩 中 心 线", scale, 2.5, 3 * scale, "SRB.HT");
            //PLPloter.AddLine(db,ptPileT.C2D(0, 5 * scale), ptPileT.C2D(0, -50 * scale), ref ext, "H中心线");
            #endregion


            #region 隔板标注
            if(BulkheadCount>0)
            {
                if(BulkheadCount==1)
                {
                    DimPloter.DimRot(db, ptBMid.C3D(), ptBMid.C3D(0,-pierPara.column.top_solid_h), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBMid.C3D(0, -pierPara.column.top_solid_h), ptBMid.C3D(0, -FH-cap-MH * 0.5 + bH *0.5), ptDim.C3D(10 * scale), ref ext, 90, scale, "h1", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBMid.C3D(0, - FH - cap - MH * 0.5 + bH * 0.5), ptBMid.C3D(0,  - FH - cap - MH * 0.5 - bH * 0.5), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBMid.C3D(0,  - FH - cap - MH * 0.5 - bH * 0.5), ptBottomC.C3D(0, pierPara.column.bottom_solid_h), ptDim.C3D(10 * scale), ref ext, 90, scale, "h1", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBottomC.C3D(0, pierPara.column.bottom_solid_h), ptBottomC.C3D(), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
                else
                {
                    DimPloter.DimRot(db, ptBMid.C3D(), ptBMid.C3D(0, -pierPara.column.top_solid_h), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBMid.C3D(0, -pierPara.column.top_solid_h), ptBMid.C3D(0, -FH - cap - MH * 0.5 + bH * 0.5), ptDim.C3D(10 * scale), ref ext, 90, scale, "h1", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBMid.C3D(0, -FH - cap - MH * 0.5 + bH * 0.5), ptBMid.C3D(0, -FH - cap - MH * 0.5 - bH * 0.5), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    double h2l = (MH  - bH) * 0.5;
                    Point3d ptH2 = ptBMid.C3D(0, -FH - cap - h2l-bH);
                    for (int i = 0; i < BulkheadCount - 1; i++)
                    {
                        ptH2 = ptH2.C3D(0,-(h2l*2 + cap+ bH)*i);
                        DimPloter.DimRot(db, ptH2.C3D(0, 0), ptH2.C3D(0, -h2l - cap - h2l), ptDim.C3D(10 * scale), ref ext, 90, scale, "h2", Unit.Centimeter, Unit.Centimeter);
                        DimPloter.DimRot(db, ptH2.C3D(0, -h2l - cap - h2l), ptH2.C3D(0, -h2l - cap - h2l-bH), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    }
                    DimPloter.DimRot(db, ptBottomC.C3D(0, BH+cap+ h2l), ptBottomC.C3D(0, pierPara.column.bottom_solid_h), ptDim.C3D(10 * scale), ref ext, 90, scale, "h1", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBottomC.C3D(0, pierPara.column.bottom_solid_h), ptBottomC.C3D(), ptDim.C3D(10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
            }
            #endregion
        }

        /// <summary>
        /// 侧面
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public static void PlotPierSide(ref Database db, ref Extents2d ext, Point2d insertPoint, PierPara pierPara, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "C-C", "1:150", scale);
            Point2d pt = insertPoint.C2D(0, -22 * scale);
            Point3d ptDim = pt.C3D(pierPara.pileCap.pile_cap_length * 0.5 + 10 * scale);
            double halfPile = 15 * scale;//桩长示意长度
            #region 盖梁外轮廓绘制
            List<Point2d> ptLst = new List<Point2d>();
            //ptLst.Add(pt);
            double BeamL = pierPara.beam_l;
            //Point2d pt1 = pt.C2D((pierPara.beam_l * 0.5), 0);
            //Point2d pt2 = pt1.C2D(0, pierPara.beam.block_h);
            //Point2d pt3 = pt2.C2D(-pierPara.beam_l, 0);
            //Point2d pt4 = pt3.C2D(0, -pierPara.beam.block_h);
            //Point2d pt5 = pt4.C2D(0, -pierPara.beam.beam_h);
            //Point2d pt6 = pt5.C2D(pierPara.beam_l);

            Point2d pt1 = pt.C2D((pierPara.beam_l * 0.5), 0);
            Point2d pt2 = pt1.C2D(0, 0);
            Point2d pt3 = pt2.C2D(-pierPara.beam_l, 0);
            Point2d pt4 = pt3.C2D(0, 0);
            Point2d pt5 = pt4.C2D(0, -pierPara.beam.beam_h);
            Point2d pt6 = pt5.C2D(pierPara.beam_l);
            ptLst.Add(pt6);
            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            ptLst.Add(pt5);
          

            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H墩身", false);
            DimPloter.DimRot(db, pt2.C3D(), pt3.C3D(), pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt5.C3D(), pt4.C3D(), pt3.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            //if (pierPara.beam.block_w > 0)
            //{
            //    DimPloter.DimRot(db, pt3.C3D(), pt4.C3D(), pt3.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //}
            Point2d ptBMid = pt.C2D(0, -(pierPara.h4 - pierPara.h3) * 100);
            ptLst = new List<Point2d>();
            Point2d pt7 = ptBMid.C2D(-pierPara.beam_l * 0.5);
            Point2d pt8 = ptBMid.C2D(pierPara.beam_l * 0.5);
            Point2d pt9 = ptBMid.C2D(-pierPara.column.top_l * 0.5);
            Point2d pt10 = ptBMid.C2D(pierPara.column.top_l * 0.5);
            ptLst.Add(pt5);
            ptLst.Add(pt7);
            ptLst.Add(pt8);
            ptLst.Add(pt6);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H墩身", false);
            //DimPloter.DimRot(db, pt5.C3D(), pt7.C3D(), pt3.C3D(-10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt4.C3D(), pt7.C3D(), pt3.C3D(-15 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt7.C3D(), pt9.C3D(), ptBMid.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt8.C3D(), pt10.C3D(), ptBMid.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt9.C3D(), pt10.C3D(), ptBMid.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            //DimPloter.DimRot(db, pt1.C3D(), pt2.C3D(0), ptDim, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt1.C3D(), pt6.C3D(0), ptDim.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt6.C3D(), pt8.C3D(0), ptDim.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt1.C3D(), pt8.C3D(0), ptDim, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion


            #region 墩身外轮廓绘制
            double cap = 2 * scale;
            int BulkheadCount = 2;
            //if (pierPara.pier_height < 35)
            //    BulkheadCount = 0;
            //else if (pierPara.pier_height >= 35 && pierPara.pier_height < 70)
            //    BulkheadCount = 1;
            //else if (pierPara.pier_height >= 70 && pierPara.pier_height < 90)
            //    BulkheadCount = 2;
            //else if (pierPara.pier_height >= 90 && pierPara.pier_height < 120)
            //    BulkheadCount = 3;
            if (pierPara.pier_height <= 30)
                BulkheadCount = 0;
            else if (pierPara.pier_height > 30 && pierPara.pier_height <= 60)
                BulkheadCount = 1;
            else if (pierPara.pier_height >= 60)
                BulkheadCount = 2;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_l_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_l_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[1]);
            double tw = double.Parse(sizeT[0]);
            double mH = double.Parse(sizeM[1]);
            double mw = double.Parse(sizeM[0]);
            double bH = double.Parse(sizeBulk[1]);
            double bw = double.Parse(sizeBulk[0]);
            //double bwL = double.Parse(sizeBulkL[1]);
            //double bH = double.Parse(sizeBulk[0]);
            //double bw = double.Parse(sizeBulk[1]);
            int thickness = pierPara.column.top_thickness;
            double topThickness = double.Parse(thickness.ToString());
            double bottomThickness = double.Parse(thickness.ToString());
            double FH = topH + tH + 15 * scale;
            double MH = 30 * scale + mH * 2 + bH;
            double BH = botH + tH + 15 * scale;
            if (BulkheadCount == 0)
            {
                FH = topH + tH + 35 * scale;
                MH = 0;
                BH = botH + tH + 35 * scale;
                if (FH + BH > pierPara.pier_height * 100)
                {
                    FH = pierPara.pier_height * 100 * 0.5;
                    MH = 0;
                    BH = pierPara.pier_height * 100 * 0.5;
                }
            }
            else if (BulkheadCount == 1)
                MH = 40 * scale + mH * 2 + bH;
            else if (BulkheadCount == 2)
                MH = 30 * scale + mH * 2 + bH;
            else
                MH = 20 * scale + mH * 2 + bH;
            #region 外轮廓上部

            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            PLPloter.AddLine(db,pt9, ptCF1, ref ext, "H墩身");
            PLPloter.AddLine(db,pt10, ptCF2, ref ext, "H墩身");
            //if (pierPara.column.slope_l > 0)
            //PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
          
            if(BulkheadCount==0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            else
                PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale - 0.5 * scale), ptCF2.C2D(5 * scale + 0.5 * scale), scale, "H细线");
            //else
            //    PLPloter.CreateBreakLineP(db, ref ext, ptCF1, ptCF2, scale, "H细线");
            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D(0, -topH);
            Point2d ptICF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
            //PLPloter.AddScaleLine(pt9.C2D(topThickness), ptICF1, ref ext, "H虚线", 2);
            //PLPloter.AddScaleLine(pt10.C2D(-topThickness), ptICF2, ref ext, "H虚线", 2);
            DimPloter.DimRot(db, ptBMid.C3D(), ptIC.C3D(0), ptDim.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            //DimPloter.DimRot(db, ptICF1.C3D(), ptICF1.C3D(tw), ptICF1.C3D(0, tH+3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICF1.C3D(), ptICF1.C3D(0, tH), ptICF1.C3D(-3*scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            Point3d ptMT = GeTools.MidPoint(ptICF2.C3D(), ptICF2.C3D(-tw, tH));
            DimPloter.AddMLeader(db,ptMT.C2D(), ptMT.C2D(topThickness + 3 * scale, -5 * scale), pierPara.column.section_l_ang, ref ext, scale);

            DimPloter.DimRot(db, pt9.C3D(), pt9.C3D(topThickness), pt9.C3D(0, 2 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt10.C3D(), pt10.C3D(-topThickness), pt9.C3D(0, 2 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt9.C3D(topThickness), pt10.C3D(-topThickness), pt9.C3D(0, 2 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #region 外轮廓中部

            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);
            if (BulkheadCount == 0)
            {
                ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -MH);
                ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -MH);
            }
            Point2d ptCM1ELast = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2ELast = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);

            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            if (pierPara.column.slope_l > 0)
            {
                TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_l, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            }
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptCF1 = ptCF1.C2D(-0.5 * scale);
                ptCF2 = ptCF2.C2D(0.5 * scale);
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                //if (pierPara.column.slope_l > 0)
                //PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                if (i == 0)
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale - 0.5 * scale * i), ptCM2.C2D(5 * scale + 0.5 * scale * i), scale, "H细线");
                else
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1ELast.C2D(-5 * scale, -cap), ptCM2ELast.C2D(5 * scale, -cap), scale, "H细线");
                //else
                //    PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(), ptCM2.C2D(), scale, "H细线");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H墩身");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H墩身");
                //if (pierPara.column.slope_l > 0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");
                //else
                //    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E, ptCM2E, scale, "H细线");
                ptCM1ELast = ptCM1E;
                ptCM2ELast = ptCM2E;

                #region 内轮廓
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i);
                ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
                Point3d ptMM = GeTools.MidPoint(ptICM4.C3D(), ptICM6.C3D());
                DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(topThickness + 3 * scale, 3 * scale), pierPara.column.section_mid_l_ang, ref ext, scale);
                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

                //DimPloter.DimRot(db, ptICM.C3D(-bw * 0.5), ptICM.C3D(bw * 0.5), ptICM.C3D(0,3*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptICM.C3D(), ptICM.C3D(0, -bH), ptICM.C3D(bw * 0.5+5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);


                if (i == BulkheadCount - 1 && bottomThickness != topThickness)
                {
                    Point2d ptTN = ptICM3.C2D(-15 * scale);
                    TextPloter.AddTexWithArrow(db,ptTN.C3D(0, 2 * scale), ref ext, "向上" + topThickness + "cm 等厚  ", scale, 2, eDirection.E_TOP, 2);
                    TextPloter.AddTexWithArrow(db,ptTN.C3D(0, -2 * scale), ref ext, "向下" + topThickness + "~" + bottomThickness + "cm 渐变", scale, 2, eDirection.E_BOTTOM, 2);
                    DimPloter.DimRot(db, ptICM3.C3D(), ptICM3.C3D(-topThickness), ptICM3.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
                #endregion
            }


            #endregion

            #region 内轮廓中部
            //Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            //Point2d ptICM1 = ptCF1.C2D(0, -cap);
            //Point2d ptICM2 = ptCF2.C2D(0, -cap);
            //double HB = (MH - mH * 2 - bH) * 0.5;
            ////Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            //for (int i = 0; i < BulkheadCount; i++)
            //{
            //    ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i);
            //    ptLst = new List<Point2d>();
            //    ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i);
            //    ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i);
            //    Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - HB);
            //    Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - HB);
            //    Point2d ptICM5 = ptICM3.C2D(mw, -mH);
            //    Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
            //    ptLst.Add(ptICM1);
            //    ptLst.Add(ptICM3);
            //    ptLst.Add(ptICM5);
            //    ptLst.Add(ptICM6);
            //    ptLst.Add(ptICM4);
            //    ptLst.Add(ptICM2);
            //    PLPloter.AddPolylineByPointList(ptLst, ref ext, "H墩身", false);
            //    Point3d ptMM = GeTools.MidPoint(ptICM4.C3D(), ptICM6.C3D());
            //    DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(topThickness + 3 * scale, 3 * scale), pierPara.column.section_mid_l_ang, ref ext, scale);
            //    #region 隔板
            //    ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
            //    PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H墩身");
            //    PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H墩身");

            //    //DimPloter.DimRot(db, ptICM.C3D(-bw * 0.5), ptICM.C3D(bw * 0.5), ptICM.C3D(0,3*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //    //DimPloter.DimRot(db, ptICM.C3D(), ptICM.C3D(0, -bH), ptICM.C3D(bw * 0.5+5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //    #endregion

            //    ptLst = new List<Point2d>();
            //    Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * (i + 1));
            //    Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * (i + 1));
            //    ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
            //    ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
            //    ptICM5 = ptICM3.C2D(mw, mH);
            //    ptICM6 = ptICM4.C2D(-mw, mH);
            //    ptLst.Add(ptCMI1E);
            //    ptLst.Add(ptICM3);
            //    ptLst.Add(ptICM5);
            //    ptLst.Add(ptICM6);
            //    ptLst.Add(ptICM4);
            //    ptLst.Add(ptCMI2E);
            //    PLPloter.AddPolylineByPointList(ptLst, ref ext, "H墩身", false);


            //    if (i == BulkheadCount - 1 && bottomThickness != topThickness)
            //    {
            //        Point2d ptTN = ptICM3.C2D(-15 * scale);
            //        TextPloter.AddTexWithArrow(db,ptTN.C3D(0, 2 * scale), ref ext, "向上" + topThickness + "cm 等厚  ", scale, 2, eDirection.E_TOP, 2);
            //        TextPloter.AddTexWithArrow(db,ptTN.C3D(0, -2 * scale), ref ext, "向下" + topThickness + "~" + bottomThickness + "cm 渐变", scale, 2, eDirection.E_BOTTOM, 2);
            //        DimPloter.DimRot(db, ptICM3.C3D(), ptICM3.C3D(-topThickness), ptICM3.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //    }
            //    //DimPloter.DimRot(db, ptICM3.C3D(), ptICM3.C3D(mw), ptICM3.C3D(0, mH + 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //    //DimPloter.DimRot(db, ptICM3.C3D(), ptICM3.C3D(0, mH), ptICM3.C3D(-3 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            //}



            #endregion

            #region 外轮廓下部

            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_l, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l, BH);
            //PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale, -cap), ptCM2E.C2D(5 * scale, -cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H墩身");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H墩身");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H墩身");

            if (pierPara.column.slope_l == 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            else
                DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "Bd2", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_l + bottomThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l - bottomThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_l + bottomThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_l - bottomThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            Point2d ptICB6 = ptICB4.C2D(-tw, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            DimPloter.DimRot(db, ptBMid.C3D(), ptBottomC.C3D(), ptDim, ref ext, 90, scale, "H", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICB3.C3D(), ptICB3.C3D(-bottomThickness), ptBottomC.C3D(0,-4*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            ////DimPloter.DimRot(db, ptICB3.C3D(), ptICB3.C3D(tw), ptICB3.C3D(0, 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            ////DimPloter.DimRot(db,  ptICB3.C3D(tw), ptICB4.C3D(-tw), ptICB3.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICB4.C3D(), ptICB4.C3D(bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptCB1E.C3D(), ptCB1E.C3D(bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICB3.C3D(), ptICB3.C3D(tw), ptICB3.C3D(0, 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptCB2E.C3D(), ptCB2E.C3D(-bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            if (pierPara.column.slope_l == 0)
                DimPloter.DimRot(db, ptCB1E.C3D(bottomThickness), ptCB2E.C3D(-bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            else
                DimPloter.DimRot(db, ptCB1E.C3D(bottomThickness), ptCB2E.C3D(-bottomThickness), ptBottomC.C3D(0, -4 * scale), ref ext, 0, scale, "Bd2-" + bottomThickness * 2, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptICB4.C3D(), ptICB4.C3D(-tw), ptICB4.C3D(0, 3 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);


            Point3d ptMB = GeTools.MidPoint(ptICB4.C3D(), ptICB6.C3D());
            DimPloter.AddMLeader(db,ptMB.C2D(), ptMB.C2D(bottomThickness + 3 * scale, 4 * scale), pierPara.column.section_l_ang, ref ext, scale);

            DimPloter.DimRot(db, ptBottomC.C3D(), ptBottomC.C3D(0, botH), ptDim.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            //PLPloter.AddScaleLine(ptCB1E.C2D(bottomThickness), ptICB3, ref ext, "H虚线", 2);
            //PLPloter.AddScaleLine(ptCB2E.C2D(-bottomThickness), ptICB4, ref ext, "H虚线", 2);
            #endregion

            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.pileCap.pile_cap_length;
            double pileCapH = pierPara.pileCap.pile_cap_height;
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H墩身", true);
            //垫层
            PLPloter.AddPloy4(db, ptBottomC.C2D(0, -pierPara.pileCap.pile_cap_height), pileCapW * 0.5 + 10, pileCapW * 0.5 + 10, 20, ref ext, "H墩身");

            DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(-pileCapW * 0.5, -pileCapH), ptDim, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0,-10*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #region 桩基外轮廓绘制

            Point2d ptPileT = ptBottomC.C2D(0, -pileCapH);
            double pileDia = pierPara.pile.dia;
            string[] span = pierPara.pile.span_l.Split('+');
            List<double> spanLst = new List<double>();
            double total = 0;
            for (int i = 0; i < span.Length; i++)
            {
                if (span[i].Contains("*"))
                {
                    string[] sp = span[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spanLst.Add(v);
                        total += v;
                    }
                }
                else
                {
                    if (double.Parse(span[i]) > 0)
                    {
                        spanLst.Add(double.Parse(span[i]));
                        total += double.Parse(span[i]);
                    }
                    else
                    {
                        spanLst.Add(0);
                    }
                }
            }
            Point2d ptSt = ptPileT.C2D(-total * 0.5);

            if (spanLst.Count > 0)
            {
                Point2d ptP1 = ptSt.C2D(-pileDia * 0.5);
                Point2d ptP2 = ptSt.C2D(pileDia * 0.5);
                //桩基
                PLPloter.AddLine(db,ptP1, ptP1.C2D(0, -halfPile), ref ext, "H墩身");
                PLPloter.AddLine(db,ptP2, ptP2.C2D(0, -halfPile), ref ext, "H墩身");

                //DimPloter.DimRot(db, ptP1.C3D(), ptP2.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptPileT.C3D(-pileCapW * 0.5), ptPileT.C3D(pileCapW * 0.5), ptPileT.C3D(0, -13 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, ptPileT.C3D(-pileCapW * 0.5), ptSt.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                //DimPloter.DimRot(db, ptPileT.C3D(-pileCapW * 0.5), ptP1.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

                PLPloter.AddUpperArcBreakLine(db, ptSt.C2D(0, -halfPile), ref ext, pileDia, "H细线");
                PLPloter.AddBottomArcBreakLine(db, ptSt.C2D(0, -5 * scale - halfPile), ref ext, pileDia, "H细线");

                PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                PLPloter.AddLine(db,ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                PLPloter.AddScaleLine(db, ptSt.C2D(), ptSt.C2D(0, -5 * scale - halfPile * 2 - 2 * scale), ref ext, "H中心线", 5);
                for (int i = 0; i < spanLst.Count; i++)
                {
                    if (spanLst[i] > 0)
                    {
                        ptSt = ptSt.C2D(spanLst[i]);
                        ptP1 = ptSt.C2D(-pileDia * 0.5);
                        ptP2 = ptSt.C2D(pileDia * 0.5);


                        DimPloter.DimRot(db, ptSt.C3D(-spanLst[i]), ptSt.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptP1.C3D(), ptP2.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptSt.C3D(-spanLst[i] + pileDia * 0.5), ptP1.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        if (i == spanLst.Count - 1)
                        {
                            //DimPloter.DimRot(db, ptPileT.C3D(pileCapW * 0.5), ptP2.C3D(), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                            DimPloter.DimRot(db, ptSt.C3D(), ptPileT.C3D(pileCapW * 0.5), ptPileT.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        }
                        //DimPloter.DimRot(db, ptSt.C3D(-spanLst[i]), ptSt.C3D(), ptPileT.C3D(0, -halfPile * 2), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //桩基
                        PLPloter.AddLine(db,ptP1, ptP1.C2D(0, -halfPile), ref ext, "H墩身");
                        PLPloter.AddLine(db,ptP2, ptP2.C2D(0, -halfPile), ref ext, "H墩身");

                        PLPloter.AddUpperArcBreakLine(db, ptSt.C2D(0, -halfPile), ref ext, pileDia, "H细线");
                        PLPloter.AddBottomArcBreakLine(db, ptSt.C2D(0, -5 * scale - halfPile), ref ext, pileDia, "H细线");

                        PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                        PLPloter.AddLine(db,ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                        PLPloter.AddLine(db,ptSt.C2D(-pileDia * 0.5, -5 * scale - halfPile - halfPile), ptSt.C2D(pileDia * 0.5, -5 * scale - halfPile - halfPile), ref ext, "H墩身");
                        PLPloter.AddScaleLine(db, ptSt.C2D(), ptSt.C2D(0, -5 * scale - halfPile * 2 - 2 * scale), ref ext, "H中心线", 5);

                    }
                }
            }

            DimPloter.DimRot(db, ptPileT.C3D(), ptPileT.C3D(0, -5 * scale - halfPile * 2), ptDim, ref ext, 90, scale, "L", Unit.Centimeter, Unit.Centimeter);

            #endregion

            #region 中心线
            PLPloter.AddScaleLine(db, pt.C2D(0, pierPara.beam.block_h), ptPileT.C2D(0, -5 * scale - halfPile - halfPile), ref ext, "H中心线", 5);
            #endregion
        }

        #endregion

        #region 墩柱截面
        public static void PlotSection1(ref Database db, ref Extents2d ext, Point2d insertPoint, PierPara pierPara, int scale)
        {
            //ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "A-A", "1:150", scale);
            Point2d pt = insertPoint.C2D(0, -5 * scale);

            PLPloter.AddPloy4(db, pt, pierPara.pileCap.pile_cap_width * 0.5, pierPara.pileCap.pile_cap_width * 0.5, pierPara.pileCap.pile_cap_length, ref ext, "H墩身");



            Point3d ptDimR = pt.C3D(pierPara.pileCap.pile_cap_width * 0.5 + 10 * scale);
            //Point3d ptDimT = pt.C3D(0,  12 * scale);
            Point3d ptDimB = pt.C3D(0, -(pierPara.pileCap.pile_cap_length + 12 * scale));
            double pileDia = pierPara.pile.dia;
            string[] spanW = pierPara.pile.span_w.Split('+');
            string[] spanL = pierPara.pile.span_l.Split('+');
            List<double> spanWLst = new List<double>();
            List<double> spanLLst = new List<double>();
            double totalW = 0;
            double totalL = 0;
            #region  桩基平面绘制
            for (int i = 0; i < spanW.Length; i++)
            {
                if (spanW[i].Contains("*"))
                {
                    string[] sp = spanW[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spanWLst.Add(v);
                        totalW += v;
                    }
                }
                else
                {
                    if (double.Parse(spanW[i]) > 0)
                    {
                        spanWLst.Add(double.Parse(spanW[i]));
                        totalW += double.Parse(spanW[i]);
                    }
                    else
                    {
                        spanWLst.Add(0);
                    }
                }
            }

            for (int i = 0; i < spanL.Length; i++)
            {
                if (spanL[i].Contains("*"))
                {
                    string[] sp = spanL[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spanLLst.Add(v);
                        totalL += v;
                    }
                }
                else
                {
                    if (double.Parse(spanL[i]) > 0)
                    {
                        spanLLst.Add(double.Parse(spanL[i]));
                        totalL += double.Parse(spanL[i]);
                    }
                    else
                    {
                        spanLLst.Add(0);
                    }
                }
            }

            Point2d ptSt = pt.C2D(0, -pierPara.pileCap.pile_cap_length * 0.5).C2D(-totalW * 0.5, totalL * 0.5);
            Point2d ptPile = ptSt;
            for (int j = 0; j < spanLLst.Count; j++)
            {
                if (spanLLst[j] > 0)
                {
                    if (j == 0)
                    {
                        ptPile = ptSt.C2D(0);
                        DrawingPile(db, spanWLst, ptPile, pileDia, ref ext);
                        ptPile = ptSt.C2D(0, -spanLLst[j]);
                        DrawingPile(db, spanWLst, ptPile, pileDia, ref ext);
                    }
                    else
                    {
                        ptPile = ptSt.C2D(0, -spanLLst[j]);
                        DrawingPile(db, spanWLst, ptPile, pileDia, ref ext);
                    }
                }
                else
                {
                    DrawingPile(db,spanWLst, ptPile, pileDia, ref ext);
                }
            }
            #endregion

            #region 标注 
            Point2d ptDim = ptSt;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            for (int i = 0; i < spanWLst.Count; i++)
            {
                if (i == 0)
                {
                    //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                    //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptDim.C3D(), pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimAli(db,ptDim.C3D(-pileDia * 0.5 * Math.Cos(GeTools.DegreeToRadian(45)), -pileDia * 0.5 * Math.Sin(GeTools.DegreeToRadian(45))), ptDim.C3D(pileDia * 0.5 * Math.Cos(GeTools.DegreeToRadian(45)), pileDia * 0.5 * Math.Sin(GeTools.DegreeToRadian(45))), ptDim.C3D(), ref ext, scale, "D=<>", Unit.Centimeter, Unit.Centimeter);
                    //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                    if (spanWLst[i] > 0)
                    {
                        ptDim = ptDim.C2D(spanWLst[i]);
                        //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(-spanWLst[i] + pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        DimPloter.DimRot(db, ptDim.C3D(), ptDim.C3D(-spanWLst[i]), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        if (i == spanWLst.Count - 1)
                        {
                            //DimPloter.DimRot(db, ptDim.C3D(pileDia * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                            DimPloter.DimRot(db, ptDim.C3D(), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        }
                    }
                }
                else
                {
                    if (spanWLst[i] > 0)
                    {
                        ptDim = ptDim.C2D(spanWLst[i]);
                        //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(-spanWLst[i] + pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        DimPloter.DimRot(db, ptDim.C3D(), ptDim.C3D(-spanWLst[i]), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        if (i == spanWLst.Count - 1)
                        {
                            //DimPloter.DimRot(db, ptDim.C3D(pileDia * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                            DimPloter.DimRot(db, ptDim.C3D(), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                        }
                    }
                }
            }

            ptDim = ptSt;
            DimPloter.DimRot(db, pt.C3D(0, -pierPara.pileCap.pile_cap_length), pt.C3D(), ptDimR.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            for (int i = 0; i < spanLLst.Count; i++)
            {
                if (i == 0)
                {
                    DimPloter.DimRot(db, ptDim.C3D(), pt.C3D(), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    //DimPloter.DimRot(db, ptDim.C3D(0, -pileDia * 0.5), ptDim.C3D(0, pileDia * 0.5), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    if (spanLLst[i] > 0)
                    {
                        ptDim = ptDim.C2D(0, -spanLLst[i]);
                        DimPloter.DimRot(db, ptDim.C3D(), ptDim.C3D(0, spanLLst[i]), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptDim.C3D(0, -pileDia * 0.5), ptDim.C3D(0, pileDia * 0.5), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                        if (i == spanLLst.Count - 1)
                        {
                            DimPloter.DimRot(db, ptDim.C3D(), pt.C3D(0, -pierPara.pileCap.pile_cap_length), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                        }
                    }
                }
                else
                {
                    if (spanLLst[i] > 0)
                    {
                        ptDim = ptDim.C2D(spanLLst[i]);
                        DimPloter.DimRot(db, ptDim.C3D(), ptDim.C3D(spanLLst[i]), ptDimB.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                        //DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                        if (i == spanLLst.Count - 1)
                        {
                            DimPloter.DimRot(db, ptDim.C3D(), pt.C3D(0, -pierPara.pileCap.pile_cap_length), ptDimB.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                        }
                    }
                }
            }
            #endregion

            #region 标注 废弃
            //Point2d ptDim = ptSt;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //for (int i = 0; i < spanWLst.Count; i++)
            //{
            //    if (i == 0)
            //    {
            //        DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), pt.C3D(-pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        DimPloter.DimRot(db, ptDim.C3D(-pileDia*0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(0,5*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        if (spanWLst[i] > 0)
            //        {
            //            ptDim = ptDim.C2D(spanWLst[i]);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(-spanWLst[i] + pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(-spanWLst[i]+pileDia * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            if (i == spanWLst.Count - 1)
            //            {
            //                DimPloter.DimRot(db, ptDim.C3D(pileDia * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //                DimPloter.DimRot(db, ptDim.C3D(pileDia * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            }
            //        }
            //    }
            //    else
            //    {
            //        if (spanWLst[i] > 0)
            //        {
            //            ptDim = ptDim.C2D(spanWLst[i]);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(-spanWLst[i] + pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(-spanWLst[i] + pileDia * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            if(i== spanWLst.Count-1)
            //            {
            //                DimPloter.DimRot(db, ptDim.C3D(pileDia * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimT.C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //                DimPloter.DimRot(db, ptDim.C3D(pileDia * 0.5), pt.C3D(pierPara.pileCap.pile_cap_width * 0.5), ptDimB.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            }
            //        }
            //    }
            //}

            //ptDim = ptSt;
            //DimPloter.DimRot(db, pt.C3D(0,-pierPara.pileCap.pile_cap_length), pt.C3D(), ptDimR.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //for (int i = 0; i < spanLLst.Count; i++)
            //{
            //    if (i == 0)
            //    {
            //        DimPloter.DimRot(db, ptDim.C3D(0, pileDia * 0.5), pt.C3D(), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        DimPloter.DimRot(db, ptDim.C3D(0, -pileDia * 0.5), ptDim.C3D(0, pileDia * 0.5), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //        if (spanLLst[i] > 0)
            //        {
            //            ptDim = ptDim.C2D(0,-spanLLst[i]);
            //            DimPloter.DimRot(db, ptDim.C3D(0, pileDia * 0.5), ptDim.C3D(0, spanLLst[i] - pileDia * 0.5), ptDimR.C3D(-5 * scale), ref ext,90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(0, -pileDia * 0.5), ptDim.C3D(0, pileDia * 0.5), ptDimR.C3D(- 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            if (i == spanLLst.Count - 1)
            //            {
            //                DimPloter.DimRot(db, ptDim.C3D(0, -pileDia * 0.5), pt.C3D(0, -pierPara.pileCap.pile_cap_length), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            }
            //        }
            //    }
            //    else
            //    {
            //        if (spanLLst[i] > 0)
            //        {
            //            ptDim = ptDim.C2D(spanLLst[i]);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(spanLLst[i] - pileDia * 0.5), ptDimB.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), ptDim.C3D(pileDia * 0.5), ptDimB.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            if (i == spanLLst.Count - 1)
            //            {
            //                DimPloter.DimRot(db, ptDim.C3D(-pileDia * 0.5), pt.C3D(0,-pierPara.pileCap.pile_cap_length), ptDimB.C3D(- 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //            }
            //        }
            //    }
            //}
            #endregion
        }

        public static void PlotSection2(ref Database db, ref Extents2d ext, Point2d insertPoint, PierPara pierPara, int scale, double TW)
        {
            //ext = new Extents2d(insertPoint, insertPoint);

            int thickness = pierPara.column.top_thickness;
            double topThickness = double.Parse(thickness.ToString());
            double bottomThickness = double.Parse(thickness.ToString());

            if (topThickness == bottomThickness)
            {
                DrawingColumnSection(ref db, ref ext, insertPoint, pierPara, scale, topThickness);
            }
            else
            {
                DrawingColumnSection(ref db, ref ext, insertPoint.C2D(-TW * 0.5), pierPara, scale, topThickness, "B-B");

                DrawingColumnSection(ref db, ref ext, insertPoint.C2D(ext.W() - TW * 0.5 + 10 * scale), pierPara, scale, bottomThickness, "D-D");
            }

        }

        private static void DrawingColumnSection(ref Database db, ref Extents2d ext, Point2d insertPoint, PierPara pierPara, int scale, double thickness, string title = "B-B")
        {
            TextPloter.AddTitle(db,insertPoint, ref ext, title, "1:150", scale);
            Point2d pt = insertPoint.C2D(0, -5 * scale);
            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            if (pierPara.column.slope_w > 0)
                W = W + 100;
            if (pierPara.column.slope_l > 0)
                L = L + 100;

            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H墩身", outL, outW, outL, outW);

            ObjectId pLId2 = PLPloter.CreatPoly8(db, pt.C2D(0, -thickness), ref ext, L - 2 * thickness, W - 2 * thickness, "H墩身", innerW, innerL, innerW, innerL);
            DimPloter.AddMLeader(db,pt.C2D(0, -thickness).C2D(-(W - 2 * thickness) * 0.5 + innerW * 0.5, -innerL * 0.5), pt.C2D(0, -thickness).C2D(-(W - 2 * thickness) * 0.5 + innerW * 0.5 + 3 * scale, -innerL * 0.5 - 3 * scale), pierPara.column.inner_section_ang, ref ext, scale);
            HatchPloter.HatchEnity(db, "ANSI31", 5, 0, pLId1, pLId2);
            if (pierPara.column.slope_w > 0)
            {
                DimPloter.DimRot(db, pt.C3D(-W * 0.5), pt.C3D(W * 0.5), pt.C3D(0, -L - 12 * scale), ref ext, 0, scale, "Bd0", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(-W * 0.5), pt.C3D(-W * 0.5 + thickness), pt.C3D(0, -L - 7 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(W * 0.5), pt.C3D(W * 0.5 - thickness), pt.C3D(0, -L - 7 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(-W * 0.5 + thickness), pt.C3D(W * 0.5 - thickness), pt.C3D(0, -L - 7 * scale), ref ext, 0, scale, "Bd0-" + thickness * 2, Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, pt.C3D(-W * 0.5), pt.C3D(W * 0.5), pt.C3D(0, -L - 12 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(-W * 0.5), pt.C3D(-W * 0.5 + thickness), pt.C3D(0, -L - 7 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(W * 0.5), pt.C3D(W * 0.5 - thickness), pt.C3D(0, -L - 7 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(-W * 0.5 + thickness), pt.C3D(W * 0.5 - thickness), pt.C3D(0, -L - 7 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            }

            if (pierPara.column.slope_l > 0)
            {
                DimPloter.DimRot(db, pt.C3D(), pt.C3D(0, -L), pt.C3D(W * 0.5 + 12 * scale), ref ext, 90, scale, "Bd", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(), pt.C3D(0, -thickness), pt.C3D(W * 0.5 + 7 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(0, -L), pt.C3D(0, -L + thickness), pt.C3D(W * 0.5 + 7 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(0, -L + thickness), pt.C3D(0, -thickness), pt.C3D(W * 0.5 + 7 * scale), ref ext, 90, scale, "Bd-" + thickness * 2, Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, pt.C3D(), pt.C3D(0, -L), pt.C3D(W * 0.5 + 12 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(), pt.C3D(0, -thickness), pt.C3D(W * 0.5 + 7 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(0, -L), pt.C3D(0, -L + thickness), pt.C3D(W * 0.5 + 7 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt.C3D(0, -L + thickness), pt.C3D(0, -thickness), pt.C3D(W * 0.5 + 7 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
        }

        private static void DrawingPile(Database db, List<double> spanWLst, Point2d ptPile, double pileDia, ref Extents2d ext)
        {
            for (int i = 0; i < spanWLst.Count; i++)
            {
                if (i == 0)
                {
                    PLPloter.AddCircle(db, ptPile, pileDia * 0.5, ref ext, "H虚线", 2);
                    if (spanWLst[i] > 0)
                    {
                        ptPile = ptPile.C2D(spanWLst[i]);
                        PLPloter.AddCircle(db, ptPile, pileDia * 0.5, ref ext, "H虚线", 2);
                    }
                }
                else
                {
                    if (spanWLst[i] > 0)
                    {
                        ptPile = ptPile.C2D(spanWLst[i]);
                        PLPloter.AddCircle(db, ptPile, pileDia * 0.5, ref ext, "H虚线", 2);
                    }
                }
            }
        }
        #endregion

        #region 注释和表格
        public static void PlotPierNote(ref Database db, ref Extents2d ext, Point2d insertPoint, List<PierPara> pierDisList, int scale = 1)
        {
            ext = new Extents2d(insertPoint, insertPoint);


            double w = 0, h = 0;
            PlotPierTB(db, ref ext, insertPoint.C3D(), pierDisList.Count + 1,
                    Extensions.curFont, scale, pierDisList, ref w, ref h);
            Point3d ptT = insertPoint.C3D(w * 0.5, 4 * scale);
            TextPloter.AddDBText(db,ptT, ref ext, "桥墩主要参数", scale, 3, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            string text = @"注:
  1.本图尺寸除高程以米为单位外，余均以厘米为单位。
  2.在墩底实心段顶部两肋各设一直径8cm的排水管，排水管向下倾斜2%.墩身范围沿高度每隔4m设直径8cm的通气孔。
  3.承台底设20cm厚C15素混凝土垫层。
  4.桩基嵌入中风化不得小于2倍桩径。";
            if (pierDisList[0].beam.slopew > 0)
                text += @"\P  5.图中α=arctg(i%),B=" + pierDisList[0].beam_w + "/COSα,K=[(B-" + pierDisList[0].beam.beam_w + "×2)COSα-" + pierDisList[0].column.top_w + "]/2";

   
          
            //if (pierDisList[0].pier_height> 60)
            //    text += @"\P  5.图中h1=30m";
            Point3d p = insertPoint.C3D(0, -h - 12 * scale);
            TextPloter.AddMText(db,p, ref ext, text, scale, 2.5, 100 * scale, Extensions.curFont);

        }

        private static void PlotPierTB(Database db, ref Extents2d ext, Point3d startPoint,
            int rowNum, string txtStyle, double scale, List<PierPara> pierPara, ref double W, ref double H)
        {
        
         
            //表格表头
            List<string> headName = new List<string>();
            headName.Add("位 置");
            headName.Add("参 数");
            headName.Add("H\\P(m)");
            headName.Add("H1\\P(m)");
            headName.Add("H2\\P(m)");
            headName.Add("H3\\P(m)");
            headName.Add("H4\\P(m)");
            headName.Add("L\\P(m)");
            if (pierPara[0].pier_height <= 30)
            {
                //headName.Add("h1\\P(m)");
                //headName.Add("h2\\P(m)");
            }
            else if (pierPara[0].pier_height> 30&& pierPara[0].pier_height <= 60)
            {
                headName.Add("h1\\P(m)");
                //headName.Add("h2\\P(m)");
            }
            else
            {
                headName.Add("h1\\P(m)");
                headName.Add("h2\\P(m)");
            }
            //headName.Add("坡度\\P(%)");

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
                BlockTableRecord modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace],
                    OpenMode.ForWrite) as BlockTableRecord;

                ObjectId id;
                TextStyleTable st = tr.GetObject(db.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
                id = st[txtStyle];
                // 创建table 
                startPoint = startPoint.C3D();
                Table tb = new Table();
                int colNum = headName.Count;
                tb.SetSize(rowNum, colNum);       // 设置几行几列
                tb.Position = startPoint;
                tb.GenerateLayout();
                #region 第一页
                #region 第一行 标题
                tb.MergeCells(CellRange.Create(tb, 0, 0, 0, 1));
                for (int i = 0; i < colNum; ++i)
                {


                    if (i == 0)
                    {
                        tb.Cells[0, i].TextString = " "; //获取i行j列数据
                        tb.Cells[0, i].Alignment = CellAlignment.BottomCenter;
                        TextPloter.AddDBText(db,startPoint.C3D(3 * scale, -9 * scale), ref ext, headName[i], scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextLeft, TextVerticalMode.TextBottom, "H细线");
                    }
                    else if (i == 1)
                    {
                        tb.Cells[0, i].TextString = " "; //获取i行j列数据
                        tb.Cells[0, i].Alignment = CellAlignment.TopCenter;
                        //TextPloter.AddDBText(db,startPoint.C3D(18 * scale, -5 * scale), ref ext, headName[i], scale);
                        TextPloter.AddDBText(db,startPoint.C3D(14 * scale, -6 * scale), ref ext, headName[i], scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextLeft, TextVerticalMode.TextBottom, "H细线");
                    }
                    else
                    {
                        tb.Cells[0, i].TextString = headName[i]; //获取i行j列数据
                        tb.Cells[0, i].Alignment = CellAlignment.MiddleCenter;
                    }
                    tb.Cells[0, i].Contents[0].TextHeight = 2.5 * scale;
                    tb.Cells[0, i].Contents[0].Rotation = 0;
                    tb.Cells[0, i].Borders.Horizontal.Margin = 1 * scale;
                    tb.Cells[0, i].Contents[0].TextStyleId = id;
                }
                PLPloter.AddLine(db,startPoint.C2D(), startPoint.C2D(12 * scale + 12 * scale, -12 * scale), ref ext, "H细线");
                tb.Rows[0].Height = 12 * scale;
                #endregion

                #region
                // 设置列宽
                for (int i = 0; i < colNum; ++i)
                {
                    if (i == 0)
                        tb.Columns[i].Width = 12 * scale;
                    else
                        tb.Columns[i].Width = 12 * scale;
                }

                #endregion
                double totalW = 0;
                int numM = 0;
                #region 设置表格值
                if (pierPara.Count > 0)
                {

                    for (int m = 0; m < pierPara.Count; m++)
                    {
                        try
                        {

                            tb.Cells[m + 1, 0].TextString = pierPara[m].name.Replace("墩柱", "").Replace("号墩", "") + "号墩"; //获取i行j列数据
                            tb.Cells[m + 1, 0].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 0].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 0].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 0].Contents[0].TextStyleId = id;
                            tb.MergeCells(CellRange.Create(tb, 1, 0, pierPara.Count, 0));

                            tb.Cells[m + 1, 1].TextString = pierPara[m].Location; //获取i行j列数据
                            tb.Cells[m + 1, 1].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 1].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 1].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 1].Contents[0].TextStyleId = id;

                            tb.Cells[m + 1, 2].TextString = pierPara[m].pier_height.ToString("0.000"); //获取i行j列数据
                            tb.Cells[m + 1, 2].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 2].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 2].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 2].Contents[0].TextStyleId = id;

                            tb.Cells[m + 1, 3].TextString = pierPara[m].h1.ToString("0.000"); //获取i行j列数据
                            tb.Cells[m + 1, 3].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 3].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 3].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 3].Contents[0].TextStyleId = id;

                            tb.Cells[m + 1, 4].TextString = pierPara[m].h2.ToString("0.000"); //获取i行j列数据
                            tb.Cells[m + 1, 4].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 4].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 4].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 4].Contents[0].TextStyleId = id;

                            tb.Cells[m + 1, 5].TextString = pierPara[m].h3.ToString("0.000"); //获取i行j列数据
                            tb.Cells[m + 1, 5].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 5].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 5].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 5].Contents[0].TextStyleId = id;

                            tb.Cells[m + 1, 6].TextString = pierPara[m].h4.ToString("0.000"); //获取i行j列数据
                            tb.Cells[m + 1, 6].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 6].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 6].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 6].Contents[0].TextStyleId = id;

                            tb.Cells[m + 1, 7].TextString = pierPara[m].pile_height.ToString("0.000"); //获取i行j列数据
                            tb.Cells[m + 1, 7].Contents[0].TextHeight = 2.5 * scale;
                            tb.Cells[m + 1, 7].Alignment = CellAlignment.MiddleCenter;
                            tb.Cells[m + 1, 7].Borders.Horizontal.Margin = 1 * scale;
                            tb.Cells[m + 1, 7].Contents[0].TextStyleId = id;


                            int BulkheadCount = 0;
                            if (pierPara[m].pier_height <= 30)
                                BulkheadCount = 0;
                            else if (pierPara[m].pier_height > 30 && pierPara[m].pier_height <= 60)
                                BulkheadCount = 1;
                            else if (pierPara[m].pier_height >= 60)
                                BulkheadCount = 2;

                            double topH = pierPara[m].column.top_solid_h;
                            double botH = pierPara[m].column.bottom_solid_h;                      
                            string[] sizeBulk = pierPara[m].column.bulkhead_size_w.Split('*');                        
                            double bH = double.Parse(sizeBulk[1]);

                            double h = pierPara[m].pier_height - topH*0.01 - botH * 0.01 - bH * 0.01 * BulkheadCount;
                            if (BulkheadCount == 0)
                            {

                            }
                            else if (BulkheadCount == 1)
                            {
                                tb.Cells[m + 1, 8].TextString = (h*0.5).ToString("0.000"); //获取i行j列数据
                                tb.Cells[m + 1, 8].Contents[0].TextHeight = 2.5 * scale;
                                tb.Cells[m + 1, 8].Alignment = CellAlignment.MiddleCenter;
                                tb.Cells[m + 1, 8].Borders.Horizontal.Margin = 1 * scale;
                                tb.Cells[m + 1, 8].Contents[0].TextStyleId = id;
                            }
                            else
                            {
                                int val = (int)(h / 3);
                                tb.Cells[m + 1, 8].TextString = (val).ToString("0.000"); //获取i行j列数据
                                tb.Cells[m + 1, 8].Contents[0].TextHeight = 2.5 * scale;
                                tb.Cells[m + 1, 8].Alignment = CellAlignment.MiddleCenter;
                                tb.Cells[m + 1, 8].Borders.Horizontal.Margin = 1 * scale;
                                tb.Cells[m + 1, 8].Contents[0].TextStyleId = id;

                                tb.Cells[m + 1, 9].TextString = (h-2* val).ToString("0.000"); //获取i行j列数据
                                tb.Cells[m + 1, 9].Contents[0].TextHeight = 2.5 * scale;
                                tb.Cells[m + 1, 9].Alignment = CellAlignment.MiddleCenter;
                                tb.Cells[m + 1, 9].Borders.Horizontal.Margin = 1 * scale;
                                tb.Cells[m + 1, 9].Contents[0].TextStyleId = id;
                            }

                            //tb.Cells[m + 1, 1].TextString = pierPara[m].pier_height.ToString("0.000"); //获取i行j列数据
                            //tb.Cells[m + 1, 1].Contents[0].TextHeight = 2 * scale;
                            //tb.Cells[m + 1, 1].Alignment = CellAlignment.MiddleCenter;
                            //tb.Cells[m + 1, 1].Borders.Horizontal.Margin = 1 * scale;
                            //tb.Cells[m + 1, 1].Contents[0].TextStyleId = id;
                        }
                        catch (Exception ex)
                        { }
                        tb.Rows[m + 1].Height = 9 * scale;
                    }
                }

                #endregion

                #region 表格添加数据

                #endregion

                tb.Layer = "H细线";
                tb.LineWeight = LineWeight.LineWeight013;
                tb.ColorIndex = 4;
                modelSpace.AppendEntity(tb);
                tr.AddNewlyCreatedDBObject(tb, true);
                ext = ext.Add(new Extents2d(tb.Bounds.Value.MinPoint.C2D(), tb.Bounds.Value.MaxPoint.C2D()));

                #region  边框粗线设置
                List<Point2d> pList = new List<Point2d>();
                Point2d pt1 = startPoint.C2D();
                pList.Add(pt1);
                Point2d pt2 = pt1.C2D(0, -tb.Height);
                pList.Add(pt2);
                Point2d pt3 = pt1.C2D(tb.Width, -tb.Height);
                pList.Add(pt3);
                Point2d pt4 = pt1.C2D(tb.Width, 0);
                pList.Add(pt4);
                PLPloter.AddPolylineByPointList(db, pList, ref ext, "H粗线", true);
                #endregion
                W = tb.Width;
                H = tb.Height;
                #endregion

                #region 其他页

                #endregion
                tr.Commit();
            }
        }
        #endregion
    }
}
